<div class="nav-sub w1180">
	<ul class="zoom">
		<li><a href="/crm/material/catelog-list">溯源类型列表</a></li>
		<li><a href="/crm/material/cate-list">溯源类目列表</a></li>
		<li><a class="on" href="/crm/material/list">溯源列表</a></li>
		<li><a href="/crm/material/report-list">溯源报告列表</a></li>
	</ul>
</div>
<div class="main-ct w1180">
	<div class="top-bar">
		<div class="custom-search">
			<label>溯源类目
				<select class="category-select" id="material_category_id">
					<option value="">请选择</option>
					<?php if ($this->cate):?>
    				<?php foreach ($this->cate as $k=>$v):?>
        				<option value="<?php echo $v['material_category_id']; ?>"><?php echo $v['material_category_name']; ?></option>
        			<?php endforeach; ?>
    				<?php endif;?>
				</select>
			</label>
			<label>材料名称<input type="text" class="tp-txt" id="material_name"></label>
			<a href="javascript:search();" class="btn-cs btn-search ml5">查 询</a>
<!-- 			<a href="javascript:;" class="btn-cs btn-green ml5">输出报表</a> -->
		</div>
		<a class="btn-cs btn-fillet btn-green" href="/crm/material/add">新增溯源</a>
	</div>
<div id="list-table"></div>
</div>

<script type="text/javascript">
    var material_category_id = $("#material_category_id").val();
    var material_name = $("#material_name").val();
    var page = 1;
    
    $(document).ready(function(){
    	ajaxListTable();
    });
    
    function search(){
    	material_category_id = $("#material_category_id").val();
    	material_name = $("#material_name").val();
    
    	ajaxListTable();
    }
    
    function paginator(page_no) {
    	page = page_no;
    	ajaxListTable();
    }
    
    function ajaxListTable(){
    	$.ajax({
            type: "post",
            url: "<?php echo $this->url('crm/material',
                array('action'=>'ajax-material-list'));?>",
            dataType:'html',
            data: { "material_category_id": material_category_id,
                	"material_name" : material_name,
    				"page":page
    		},
            cache: false,
            timeout:10000, 
            error: function(){
              	 alert('请求超时，请重新操作');
               	 isPost = false;
                 return false; 
             }, 
            success: function(html){
            	$("#list-table").html(html);
            }
        });
    }


</script>